package com.seecen.controller;

import com.seecen.pojo.dto.UserDto;
import com.seecen.pojo.entity.User;
import com.seecen.service.UserService;
import com.seecen.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: pet
 * @description:
 * @author: king
 * @create: 2025-10-16 15:09
 * @version: 1.0
 **/
@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
    public Result login(@RequestBody UserDto userDto){
        return userService.login(userDto);
    }

    @PutMapping("/register")
    public Result register(@RequestBody User user){
        return userService.register(user);
    }

    @GetMapping("/info")
    public Result getUser(@RequestHeader String token){
        return userService.getUser(token);
    }
}